import { createSlice } from '@reduxjs/toolkit'
import type { BreadcrumbState } from '../interface'

const breadcrumbState: BreadcrumbState = {
  breadcrumbList: [],
}

const breadcrumb = createSlice({
  name: 'breadcrumb',
  initialState: breadcrumbState,
  reducers: {
    // 设置面包屑
    setBreadcrumbList(state, action) {
      state.breadcrumbList = action.payload
    }
  }
})

const { setBreadcrumbList } = breadcrumb.actions
export { setBreadcrumbList }

export default breadcrumb.reducer